using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableHeroBreachedDao:DaoBase<TableHeroBreached>
    {
        public override void AddPrimaryIndex(TableHeroBreached model)
        {
            cachePrimary[model.id.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableHeroBreached.txt";
        }

        protected override TableHeroBreached ParseRowData(string[] rowData)
        {
            TableHeroBreached data = new TableHeroBreached();
			data.id = rowData [0];

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.Exp = 0;
            }
            else
            {
                data.Exp = double.Parse(rowData[1]);
            }
			data.Cost = rowData [2];
			data.ExpIncrease = rowData [3];

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.Critical1 = 0;
            }
            else
            {
                data.Critical1 = double.Parse(rowData[4]);
            }

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.Critical2 = 0;
            }
            else
            {
                data.Critical2 = double.Parse(rowData[5]);
            }

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.Critical3 = 0;
            }
            else
            {
                data.Critical3 = double.Parse(rowData[6]);
            }

            if (string.IsNullOrEmpty(rowData[7]))
            {
                data.Criprobability1 = 0;
            }
            else
            {
                data.Criprobability1 = double.Parse(rowData[7]);
            }

            if (string.IsNullOrEmpty(rowData[8]))
            {
                data.Criprobability2 = 0;
            }
            else
            {
                data.Criprobability2 = double.Parse(rowData[8]);
            }

            if (string.IsNullOrEmpty(rowData[9]))
            {
                data.Criprobability3 = 0;
            }
            else
            {
                data.Criprobability3 = double.Parse(rowData[9]);
            }

            if (string.IsNullOrEmpty(rowData[10]))
            {
                data.Criprobability4 = 0;
            }
            else
            {
                data.Criprobability4 = double.Parse(rowData[10]);
            }

            if (string.IsNullOrEmpty(rowData[11]))
            {
                data.AttAddPercent = 0;
            }
            else
            {
                data.AttAddPercent = double.Parse(rowData[11]);
            }

            if (string.IsNullOrEmpty(rowData[12]))
            {
                data.HpAddPercent = 0;
            }
            else
            {
                data.HpAddPercent = double.Parse(rowData[12]);
            }

            if (string.IsNullOrEmpty(rowData[13]))
            {
                data.PDefAddPercent = 0;
            }
            else
            {
                data.PDefAddPercent = double.Parse(rowData[13]);
            }

            if (string.IsNullOrEmpty(rowData[14]))
            {
                data.MDefAddPercent = 0;
            }
            else
            {
                data.MDefAddPercent = double.Parse(rowData[14]);
            }

            return data;
        }



    }

}
